package mobile.models;

import java.util.ArrayList;
import java.util.List;

import org.apache.ibatis.session.SqlSession;

import com.aton.db.SessionFactory;

import models.mappers.JPushMapper;

public class JPush {
	
	public String jPushId;
	public Long userId;
	
	
	public void save(){
		SqlSession ss = SessionFactory.getSqlSession();
		try{
			JPushMapper mapper = ss.getMapper(JPushMapper.class);
			mapper.del(this);
			mapper.insert(this);
		}finally{
			ss.close();
		}
	}
	
	
	public List<JPush> queryAllPush(){
		List<JPush> list = new ArrayList<>();
		SqlSession ss = SessionFactory.getSqlSession();
		try{
			JPushMapper mapper = ss.getMapper(JPushMapper.class);
			mapper.queryAllPush();
		}finally{
			ss.close();
		}
		return list;
	}
	
}
